package com.yanqu.road.server.cmd.activity.busyfarming;


import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.activity.BusyFarmingProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.activity.busyfarming.BusyFarmingMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_BUSY_FARMING_STEAL_NOTIFY_FROM_CROSS,desc = "偷菜跨服通知")
public class BusyFarmingStealNotifyCmdFromCross implements Command {


    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {

        BusyFarmingProto.CrossBusyFarmingStealNotifyMsg notifyMsg = BusyFarmingProto.CrossBusyFarmingStealNotifyMsg.parseFrom(packet.getBytes());
        UserBaseInfo enemyBaseInfo = PlayerBasePb.parseToUserBaseInfo(notifyMsg.getEnemy());
        BusyFarmingMgr.crossNotifyStolen(notifyMsg.getActivityId(), notifyMsg.getUserId(), notifyMsg.getLandId(), notifyMsg.getSeedId(), notifyMsg.getEnemyUserId(), enemyBaseInfo, notifyMsg.getNum());
    }
}
